const bannerDao = require("../dao/bannerDao");
const { handleDataArr } = require("../utils/tool");
//获取首页信息
const getBannerInfo = async () => {
  const data = handleDataArr(await bannerDao.getBanner());
  return data;
};

//设置首页信息
const setBannerInfo = async (info) => {
  const data = await bannerDao.setBanner(info);

  return data.toJSON();
};

//添加首页信息
const addBannerInfo = async (info) => {
  await bannerDao.addBanner(info);
  return await bannerDao.getBanner();
};

module.exports = {
  getBannerInfo,
  setBannerInfo,
  addBannerInfo,
};
